﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using DevExpress.Xpo;
using Component;

public partial class FrontEnd_Body_Center_HinhKhacCuaSanPham : System.Web.UI.UserControl
{

    public XPCollection<ProductImg> _xpProImg = new XPCollection<ProductImg>(KetNoiCSDL.session);
    public string _ProductImg = "";
    public int _pagemaxKH = 0;
    public string _Start="";
    protected void Page_Load(object sender, EventArgs e)
    {
        int idProduct = ConvertType.ToInt(QueryHelper.GetQueryString(Request, ConstString._id));       
        _xpProImg = ProductImgDB.GetAllObjByIdProduct(idProduct);
        int dem=0;
        foreach (ProductImg img in _xpProImg)
        {
            if (dem<4)
                _Start+= @"<a id=""aKH"+dem+@"""rel=""lightbox"" href="""+img.PathImgBig+@"""><img src="""+img.PathImgSmall+@""" border=""none"" class=""bg_hinhanhthem""/></a>";
            _ProductImg += string.Format("{0},{1};", img.PathImgSmall, img.PathImgBig);
            dem++;
        }
        if (_ProductImg == "")
            return;
        else
            _ProductImg = _ProductImg.Substring(0, _ProductImg.Length - 1);
        _ProductImg += "";
        _pagemaxKH = _xpProImg.Count % 4 == 0 ? (_xpProImg.Count / 4) : ((_xpProImg.Count / 4) + 1);
    }
}
